const express = require('express')
const router = express.Router()
const teamsApi = require('../controller/teams')

router.get('/teams', teamsApi.searchTeamByCode)

router.post('/teams', teamsApi.createTeam)

router.get('/teams/:teamId', teamsApi.getTeamInfo)

router.patch('/teams/:teamId', teamsApi.updateTeamInfo)

router.get('/teams/:teamId/users', teamsApi.getAllMembers)

router.post('/teams/:teamId/users/:userId', teamsApi.addMember)

router.get('/teams/:teamId/managementtags', teamsApi.getAllTags)

router.post('/teams/:teamId/managementtags', teamsApi.createTag)

router.put('/teams/:teamId/managementtags/:tagId', teamsApi.updateTag)

router.delete('/teams/:teamId/managementtags/:tagId', teamsApi.deleteTag)

router.post('/teams/:teamId/users/:userId/managementtags/:tagId', teamsApi.addTagToSb)

router.delete('/teams/:teamId/users/:userId/managementtags/:tagId', teamsApi.removeTagFromSb)

exports = module.exports = router
